home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gtlayout / source / ltp_delay.c < prev    next >
C/C++ Source or Header  |  1999-04-19  |  1KB  |  56 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. /*****************************************************************************/
  15.  
  16. #include <devices/timer.h>
  17.  
  18. #include <clib/alib_protos.h>    /* For NewList */
  19.  
  20. /*****************************************************************************/
  21.  
  22. #include "Assert.h"
  23.  
  24. VOID
  25. LTP_Delay(ULONG Seconds,ULONG Micros)
  26. {
  27.     struct MsgPort         TimePort;
  28.     struct timerequest    TimeRequest;
  29.  
  30.     memset(&TimePort,0,sizeof(TimePort));
  31.  
  32.     NewList(&TimePort.mp_MsgList);
  33.  
  34.     TimePort.mp_Flags    = PA_SIGNAL;
  35.     TimePort.mp_SigBit    = SIGB_SINGLE;
  36.     TimePort.mp_SigTask    = FindTask(NULL);
  37.  
  38.     memset(&TimeRequest,0,sizeof(TimeRequest));
  39.  
  40.     TimeRequest.tr_node.io_Message.mn_ReplyPort    = &TimePort;
  41.     TimeRequest.tr_node.io_Message.mn_Length    = sizeof(struct timerequest);
  42.  
  43.     if(!OpenDevice(TIMERNAME,UNIT_VBLANK,&TimeRequest,NULL))
  44.     {
  45.         TimeRequest.tr_node.io_Command    = TR_ADDREQUEST;
  46.         TimeRequest.tr_time.tv_secs     = Seconds;
  47.         TimeRequest.tr_time.tv_micro    = Micros;
  48.  
  49.         SetSignal(0,SIGF_SINGLE);
  50.         SendIO(&TimeRequest);
  51.         WaitIO(&TimeRequest);
  52.  
  53.         CloseDevice(&TimeRequest);
  54.     }
  55. }
  56.